package main

import (
	"fmt"
	"hsy/server/controller"
	"hsy/server/framework"
	"net/http"
	"time"
)

func main() {
	server := &http.Server{
		Addr:        ":9000",
		Handler:     framework.Router,
		ReadTimeout: 5 * time.Second,
	}
	RegiterRouter(framework.Router)

	err := server.ListenAndServe()
	if err != nil {
		fmt.Errorf("server start up faild:%v", err.Error())
	}
	fmt.Println("server start success,Listen Address:localhost:9000")
}

//RegiterRouter 注册路由
func RegiterRouter(handler *framework.RouterHandler) {
	new(controller.CategoryController).Router(handler)
}
